﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Teacher
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            logout_user();
        }
        //登出后重新登录 重新获得一份全局的老师信息
        private void logout_user()
        {
            this.Visible = false;
            login frm_login = new login();
            if (frm_login.ShowDialog() == DialogResult.OK)
            {
                this.Visible = true;
                tea_name.Text = Model.log_info.teacher.teacher_name;
                tea_uname.Text = Model.log_info.teacher.teacher_uname;

            }
            else
                this.Close();
        }
        private void clear_message()
        {
            tea_name.Text = "";
            phone.Text = "";
            tea_uname.Text = "";

            this.Visible = false;

            Model.log_info.teacher = null;
        }



        private void button1_Click(object sender, EventArgs e)
        {
            clear_message();
            logout_user();
        }

        private void select_Click(object sender, EventArgs e)
        {
            select_student select_gruop = new select_student();
            select_gruop.ShowDialog();
            
        }
    }
}
